<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html >
    <head>
        <title>MVC Template App</title>

    </head>
    <body>

        <form:form modelAttribute="loginForm" method="POST" action="login.htm" htmlEscape="true">
            <form:input path="username" />            							
            <form:input path="password" />            
            <input type="submit" name="action" value="save"/>
            <input type="submit" name="action" value="search"/>
            <input type="submit" name="action" value="new"/>
        </form:form>	
        <table>
            <tr><td>No.</td><td>Username</td><td>Password</td></tr>
            <c:forEach items="${searchResult}" var="current" varStatus="index">
                <tr>
                    <td >${index.index + 1}</td>
                    <td ><c:out value="${current.username}" /></td>
                    <td ><c:out value="${current.password}" /></td>
                    <td ><a href="login.htm?editIndex=${index.index}">Edit</a></td>
                    <td ><a href="login.htm?removeIndex=${index.index}">Remove</a></td>
                </tr>
            </c:forEach>
        </table>    
    </body>
</html>
